#include "fxcc/yml/Serializer.h"
#include "fxcc/core/graph/common/TextLine.h"

using namespace fxcc::yml;
using CType = fxcc::graph::common::TextLine;;

template<>
void Serializer::Encode<CType>(YAML::Node& node, const CType& inst)
{

	SetVariable<std::string>(node ,"m_Text", inst.m_Text);
	SetVariable<std::string>(node, "m_FontFamily", inst.m_FontFamily);
	SetVariable<glm::vec2>(node, "m_Pos", inst.m_Pos);
	SetVariable<glm::vec4>(node, "m_TextColor", inst.m_TextColor);
	SetVariable<glm::vec2>(node, "m_LimitSize", inst.m_LimitSize);
	SetVariable<int>(node ,"m_FontSize", inst.m_FontSize);
	SetVariable<bool>(node, "m_UseLimit", inst.m_UseLimit);
}


template<>
bool Serializer::Decode<CType>(const YAML::Node& node, CType& inst)
{
	GetVariable<std::string>(node, "m_Text", inst.m_Text);
	GetVariable<std::string>(node, "m_FontFamily", inst.m_FontFamily);
	GetVariable<glm::vec2>(node, "m_Pos", inst.m_Pos);
	GetVariable<glm::vec4>(node, "m_TextColor", inst.m_TextColor);
	GetVariable<glm::vec2>(node, "m_LimitSize", inst.m_LimitSize);
	GetVariable<int>(node, "m_FontSize", inst.m_FontSize);
	GetVariable<bool>(node, "m_UseLimit", inst.m_UseLimit);

	return true;
}